import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

import java.util.Set;

public class RedisDemoGenetic {
    public static void test1(Jedis jedis) {
        System.out.println("genetic");
        jedis.flushAll();
        jedis.set("key","111");
        jedis.set("key1","222");
        String result = jedis.get("key");
        System.out.println(result);
        boolean result1 = jedis.exists("key2");
        System.out.println(result1);
        Set<String> set = jedis.keys("*");
        System.out.println("set:" + set);
        jedis.expire("key",10);
        long time = jedis.ttl("key");
        System.out.println("time:" + time);
        String type = jedis.type("key");
        System.out.println("type:" + type);
    }
    public static void main(String[] args) {
        JedisPool jedisPool = new JedisPool("tcp://127.0.0.1:8888");
        try (Jedis jedis = jedisPool.getResource()) {
            test1(jedis);
        }
    }
}
